﻿using System;
using visinia.SmartEngine;
using visinia.SmartEngine.Installer;

namespace visinia.web.admin.pages
{
    public partial class AdminInstalledPlugins : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void PLUGINS_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditPlugin")
            {
                int index = Convert.ToInt32(e.CommandArgument);
                string pluginid = PLUGINS.Rows[index].Cells[0].Text;
                Response.Redirect(SystemMenu.CallPage("_Admin", "EditPlugin", "PluginId", pluginid));
            }
            if (e.CommandName == "Uninstall")
            {
                int index = Convert.ToInt32(e.CommandArgument);
                int pluginid = Convert.ToInt32(PLUGINS.Rows[index].Cells[0].Text);
                InstallController.UnInstallPlugin(pluginid);
                Response.Redirect(Request.RawUrl);
            }
        }
        protected void NEW_PLUGIN_Click(object sender, EventArgs e)
        {
            Response.Redirect(SystemMenu.CallPage("_Install", "Plugin"));
        }
    }
}